
  <template>
  <div class="bf-commont-template">
    <!--<h3>我的申请</h3>   -->
    <div class="clearfix bf-top-button">
      <div class="float-r">
        <div class="float-l">
          <el-input placeholder="请输入员工名称搜索内容" prefix-icon="el-icon-search" v-model="searchData" @keyup.enter.native="quickSearch"></el-input>
        </div>
        <div class="float-l padding-l">
          <el-button @click="showSearch" type="primary">高级筛选</el-button>
        </div>
      </div>
    </div>

    <div class="margin-l margin-r">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane :label="'入职申请'+ tabs.countEntry" status="4" name="countEntry">
          <bf-table :data="userData" :setting="entryListSetting" :rowAction="entryRowAction" @editSubmit="editSubmit" @pageChange="pageChange" ref="table"></bf-table>
        </el-tab-pane>
        <el-tab-pane :label="'试用延期'+ tabs.countDelay" status="0" name="countDelay">
          <bf-table :data="userData" :setting="delayListSetting" :rowAction="delayRowAction" @editSubmit="editSubmit" @pageChange="pageChange" ref="table"></bf-table>
        </el-tab-pane>
        <el-tab-pane :label="'转正申请' + tabs.countConrrection" status="1" name="countConrrection">
          <bf-table :data="userData" :setting="conrrectionListSetting" :rowAction="conrrectionRowAction" @editSubmit="editSubmit" @pageChange="pageChange" ref="table"></bf-table>
        </el-tab-pane>
        <el-tab-pane :label="'调动申请' + tabs.countTurnover" status="2" name="countTurnover">
          <bf-table :data="userData" :setting="turnoverListSetting" :rowAction="turnoverRowAction" @editSubmit="editSubmit" @pageChange="pageChange" ref="table"></bf-table>
        </el-tab-pane>
        <el-tab-pane :label="'离职申请' + tabs.countLeave" status="3" name="countLeave">
          <bf-table :data="userData" :setting="leaveListSetting" :rowAction="leaveRowAction" @editSubmit="editSubmit" @pageChange="pageChange" ref="table"></bf-table>
        </el-tab-pane>
      </el-tabs>
    </div>

    <!--高级搜索 -->
    <bf-table-search :editForm='searchSetting' :title="'高级搜索'"  ref='searchRosterRef' @formSubmit='searchRosterSubmit'></bf-table-search>

    <!-- 入职申请 -->
    <bf-table-edit  :editForm='entryApproveSetting' :title="'入职申请'" :submitButtons="entryApproveSubmitButtons" ref='entryApproveRef' :editRules="entryRules"></bf-table-edit>
    <!--入职详情-->
    <bf-table-detail ref="entryDetailRef" :title="'入职详情'" :editForm="entryDetailSetting"
    :showHistory='true'
    :approveSetting='entrySettingHis'></bf-table-detail>

    <!-- 延期申请 -->
    <bf-table-edit  :editForm='delayApproveSetting' :title="'延期申请'" :submitButtons="delayApproveSubmitButtons" ref='delayApproveRef' :editRules="delayRules"></bf-table-edit>
    <!--延期详情-->
    <bf-table-detail  ref="delayDetailRef" :title="'延期详情'" :editForm="delayDetailSetting"
    :showHistory='true'
    :approveSetting='delaySettingHis'
    ></bf-table-detail>
    <!-- 转正详情 -->
    <bf-table-detail :width="800" :rowNum="2" ref="conrrectionDetailRef" :title="'转正详情'" :editForm="conrrectionDetailSetting"
    :showHistory='true'
    :approveSetting='conrrectionSettingHis'
    ></bf-table-detail>
    <!-- 转正申请 -->
    <bf-table-edit :width="800" :rowNum="2" :editForm='conrrectionApproveSetting' :title="'转正申请'" :submitButtons="conrrectionApproveSubmitButtons" ref='conrrectionApproveRef' :editRules="conrrectionRules"></bf-table-edit>
    <!--调动详情-->
    <bf-table-detail :width="800" :rowNum="2" ref="turnoverDetailRef" :title="'调动详情'" :editForm="changeRosterFormDetail"
    :showHistory='true'
    :approveSetting='turnoverSettingHis'
    ></bf-table-detail>
    <!-- 调动申请 -->
    <bf-table-edit :width="800" :rowNum="2" :editForm='changeRosterForm' :title="'调动申请'" :submitButtons="turnoverApproveSubmitButtons" ref='turnoverApproveRef' :editRules="conrrectionRules"></bf-table-edit>

    <!--离职详情-->
    <bf-table-detail :width="800" :rowNum="2" ref="leaveDetailRef" :title="'离职详情'" :editForm="leaveDetailSetting"
    :showHistory='true'
    :approveSetting='leaveSettingHis'
    ></bf-table-detail>
    <!-- 离职审批 -->
    <bf-table-edit :width="800" :rowNum="2" :editForm='leaveApproveSetting' :title="'离职申请'" :submitButtons="leaveApproveSubmitButtons" ref='leaveApproveRef' :editRules="leaveRules"></bf-table-edit>

  </div>
</template>

<script>
import { findStatusCount, getEntryList, getDealDelayList, getConrrectionList, getTurnoverList, getLeaveList, findEntryDetail, findDelayDetail, findConrrectDetail, findTurnoverDetail, findLeaveDetail, updateBackDelay, dealDelayApprove, dealConrrectionApprove, dealTurnoverApprove, dealLeaveApprove } from './api.js'
import { changeRosterFormDetail, searchSetting, entryListSetting, entryDetailSetting, entryApproveSetting, delayListSetting, delayDetailSetting, delayApproveSetting, conrrectionListSetting, conrrectionDetailSetting, conrrectionApproveSetting, turnoverListSetting, turnoverDetailSetting, changeRosterForm, leaveListSetting, leaveDetailSetting, leaveApproveSetting } from './table.setting.js'
export default {
  data() {
    return {
      changeRosterFormDetail: changeRosterFormDetail,
      entrySettingHis: {
        procDefKey: 'employee-entry',
        businessKey: ''
      },
      delaySettingHis: {
        procDefKey: 'employee-delay',
        businessKey: ''
      },
      conrrectionSettingHis: {
        procDefKey: 'employee-conrrection',
        businessKey: ''
      },
      turnoverSettingHis: {
        procDefKey: 'employee-turnover',
        businessKey: ''
      },
      leaveSettingHis: {
        procDefKey: 'employee-leave',
        businessKey: ''
      },

      searchData: '',
      activeName: 'countEntry',
      statusData: {},
      entryApproveSubmitButtons: [
        {
          // 保存  action 1    status 0
          // 提交  action 1    status 1
          // 放弃  action 0    status 1
          title: '提交',
          click: (form) => {
            form.action = 1
            form.status = 1
            this.entryApprove(form)
            // updateBackDelay
          }
        },
        {
          title: '保存',
          click: (form) => {
            form.action = 1
            form.status = 0
            this.entryApprove(form)
          }
        },
        {
          title: '取消',
          validate: false,
          click: (form) => {
            this.$refs.entryApproveRef.hiden()
          }
        }
      ],
      delayApproveSubmitButtons: [
        {
          title: '提交',
          click: (form) => {
            form.action = 1
            form.status = 1
            this.delayApprove(form)
          }
        },
        {
          title: '保存',
          click: (form) => {
            form.action = 1
            form.status = 0
            this.delayApprove(form)
          }
        },
        {
          title: '取消',
          validate: false,
          click: (form) => {
            this.$refs.delayApproveRef.hiden()
          }
        }
      ],

      conrrectionApproveSubmitButtons: [
        {
          title: '提交',
          click: (form) => {
            form.action = 1
            form.status = 1
            this.conrrectionApprove(form)
          }
        },
        {
          title: '保存',
          click: (form) => {
            form.action = 1
            form.status = 0
            // console.log(form)

            this.conrrectionApprove(form)
          }
        },
        {
          title: '取消',
          validate: false,
          click: (form) => {
            this.$refs.conrrectionApproveRef.hiden()
          }
        }
      ],
      turnoverApproveSubmitButtons: [
        {
          title: '提交',
          click: (form) => {
            form.action = 1
            form.status = 1
            this.turnoverApprove(form)
          }
        },
        {
          title: '保存',
          click: (form) => {
            form.action = 1
            form.status = 0
            // console.log(form)

            this.turnoverApprove(form)
          }
        },
        {
          title: '取消',
          validate: false,
          click: (form) => {
            this.$refs.turnoverApproveRef.hiden()
          }
        }
      ],
      leaveApproveSubmitButtons: [
        {
          title: '提交',
          click: (form) => {
            form.action = 1
            form.status = 1

            this.leaveApprove(form)
          }
        },
        {
          title: '保存',
          click: (form) => {
            form.action = 1
            form.status = 0
            this.leaveApprove(form)
          }
        },
        {
          title: '取消',
          validate: false,
          click: (form) => {
            this.$refs.leaveApproveRef.hiden()
          }
        }
      ],
      tabs: {
        countEntry: 0,
        countDelay: 0,
        countConrrection: 0,
        countTurnover: 0,
        countLeave: 0,
      },
      userData: {
      },

      entryRowAction: [
        {
          label: '查看',
          click: (item) => {
            this.entrySettingHis.businessKey = item.scope.row.id
            this.findDetailById(item.scope.row.id, this.$refs.entryDetailRef.show)
          }
        },
        {
          label: '编辑',
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modifyEntry') {
              return true
            } else {
              return false
            }
          },
          click: (item) => {
            if (item.scope.row.taskDefKey === 'modifyEntry') {
              this.findDetailById(item.scope.row.id, this.$refs.entryApproveRef.show)
            } else {
              this.$message({
                message: '该阶段不可编辑',
                type: 'error'
              })
              return false
            }
          }
        },
        {

          // 保存  action 1    status 0
          // 提交  action 1    status 1
          // 放弃  action 0    status 1
          // label: '提交',
          // hiddenStatus: (row) => {
          //   if (row.taskDefKey === 'modifyEntry')  {
          //     return true
          //   } else {
          //     return false
          //   }
          // },
          click: (item) => {
            if (item.scope.row.taskDefKey === 'modifyEntry') {
              this.listApprove(item.scope.row.id, 1, 1)
            } else {
              this.$message({
                message: '该阶段不可提交',
                type: 'error'
              })
              return false
            }
          }
        }

      ],
      delayRowAction: [
        {
          label: '查看',
          click: (item) => {
            this.delaySettingHis.businessKey = item.scope.row.id
            this.findDetailById(item.scope.row.id, this.$refs.delayDetailRef.show)
          }
        },
        {
          label: '编辑',
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modify') {
              return true
            } else {
              return false
            }
          },
          click: (item) => {
            if (item.scope.row.taskDefKey === 'modify') {
              this.findDetailById(item.scope.row.id, this.$refs.delayApproveRef.show)
            } else {
              this.$message({
                message: '该阶段不可编辑',
                type: 'error'
              })
              return false
            }
          }
        },
        // {
        //   label: '提交',
        //   click: (item) => {
        //     if (item.scope.row.taskDefKey === 'modify') {
        //       this.listApprove(item.scope.row.id, 1, 1)
        //       // item.scope.row.action = 1
        //       // item.scope.row.status = 1
        //       // this.delayApprove(item.scope.row)
        //     } else {
        //       this.$message({
        //         message: '该阶段不可提交',
        //         type: 'error'
        //       })
        //       return false
        //     }
        //   }
        // },
        {
          label: '放弃',
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modify') {
              return true
            } else {
              return false
            }
          },
          click: (item) => {
            if (item.scope.row.taskDefKey === 'modify') {
              // item.scope.row.action = '0'
              // item.scope.row.status = '1'
              // this.delayApprove(item.scope.row)
              this.listApprove(item.scope.row.id, 1, 0)
            } else {
              this.$message({
                message: '该阶段不可放弃',
                type: 'error'
              })
              return false
            }
          }
        }

      ],
      conrrectionRowAction: [
        {
          label: '查看',
          click: (item) => {
            this.conrrectionSettingHis.businessKey = item.scope.row.id
            this.findDetailById(item.scope.row.id, this.$refs.conrrectionDetailRef.show)
          }
        },
        {
          label: '编辑',
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modifyConrrection') {
              return true
            } else {
              return false
            }
          },
          click: (item) => {
            if (item.scope.row.taskDefKey === 'modifyConrrection') {
              this.findDetailById(item.scope.row.id, this.$refs.conrrectionApproveRef.show)
            } else {
              this.$message({
                message: '该阶段不可编辑',
                type: 'error'
              })
              return false
            }
          }
        },
        // {
        //   label: '提交',
        //   click: (item) => {
        //     if (item.scope.row.taskDefKey === 'modifyConrrection') {
        //       // item.scope.row.action = 1
        //       // item.scope.row.status = 1
        //       // this.conrrectionApprove(item.scope.row)
        //       this.listApprove(item.scope.row.id, 1, 1)
        //     } else {
        //       this.$message({
        //         message: '该阶段不可提交',
        //         type: 'error'
        //       })
        //       return false
        //     }
        //   }
        // },
        {
          label: '放弃',
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modifyConrrection') {
              return true
            } else {
              return false
            }
          },
          click: (item) => {
            if (item.scope.row.taskDefKey === 'modifyConrrection') {
              // item.scope.row.action = '0'
              // item.scope.row.status = '1'
              // this.conrrectionApprove(item.scope.row)
              this.listApprove(item.scope.row.id, 1, 0)
              // this.findDetailById(item.scope.row.id, this.$refs.conrrectionApproveRef.show)
            } else {
              this.$message({
                message: '该阶段不可放弃',
                type: 'error'
              })
              return false
            }
          }
        }

      ],
      turnoverRowAction: [
        {
          label: '查看',
          click: (item) => {
            this.turnoverSettingHis.businessKey = item.scope.row.id
            this.findDetailById(item.scope.row.id, this.$refs.turnoverDetailRef.show, true)
          }
        },
        {
          label: '编辑',
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modifyTurnover') {
              return true
            } else {
              return false
            }
          },
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modifyTurnover') {
              return true
            } else {
              return false
            }
          },
          click: (item) => {
            this.findDetailById(item.scope.row.id, this.$refs.turnoverApproveRef.show)
          }
        },
        {
          label: '放弃',
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modifyTurnover') {
              return true
            } else {
              return false
            }
          },
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modifyTurnover') {
              return true
            } else {
              return false
            }
          },
          click: (item) => {
            if (item.scope.row.taskDefKey === 'modifyTurnover') {
              // item.scope.row.action = '0'
              // item.scope.row.status = '1'
              // this.leaveApprove(item.scope.row)
              this.listApprove(item.scope.row.id, 1, 0)
            } else {
              this.$message({
                message: '该阶段不可放弃',
                type: 'error'
              })
              return false
            }
          }
        }

      ],
      leaveRowAction: [
        {
          label: '查看',
          click: (item) => {
            this.leaveSettingHis.businessKey = item.scope.row.id
            this.findDetailById(item.scope.row.id, this.$refs.leaveDetailRef.show)
          }
        },
        {
          label: '编辑',
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modify') {
              return true
            } else {
              return false
            }
          },
          click: (item) => {
            if (item.scope.row.taskDefKey === 'modify') {
              this.findDetailById(item.scope.row.id, this.$refs.leaveApproveRef.show)
              // this.findDetailById(item.scope.row.id, this.$refs.leaveApproveRef.show)
            } else {
              this.$message({
                message: '该阶段不可编辑！',
                type: 'error'
              })
              return false
            }
          }
        },
        // {
        //   label: '提交',
        //   click: (item) => {
        //     if (item.scope.row.taskDefKey === 'modify') {
        //       // item.scope.row.action = 1
        //       // item.scope.row.status = 1
        //       // this.leaveApprove(item.scope.row)
        //       this.listApprove(item.scope.row.id, 1, 1)
        //     } else {
        //       this.$message({
        //         message: '该阶段不可提交',
        //         type: 'error'
        //       })
        //       return false
        //     }
        //   }
        // },
        {
          label: '放弃',
          hiddenStatus: (row) => {
            if (row.taskDefKey === 'modify') {
              return true
            } else {
              return false
            }
          },
          click: (item) => {
            if (item.scope.row.taskDefKey === 'modify') {
              // item.scope.row.action = '0'
              // item.scope.row.status = '1'
              // this.leaveApprove(item.scope.row)
              this.listApprove(item.scope.row.id, 1, 0)
            } else {
              this.$message({
                message: '该阶段不可放弃',
                type: 'error'
              })
              return false
            }

            // this.findDetailById(item.scope.row.id, this.$refs.delayApproveRef.show)
          }
        }

      ],
      //
      searchSetting: searchSetting,
      entryListSetting: entryListSetting, // 入职
      entryDetailSetting: entryDetailSetting,
      entryApproveSetting: entryApproveSetting,
      delayListSetting: delayListSetting, // 延期列表
      delayDetailSetting: delayDetailSetting,
      delayApproveSetting: delayApproveSetting,
      conrrectionListSetting: conrrectionListSetting, // 转正
      conrrectionDetailSetting: conrrectionDetailSetting,
      conrrectionApproveSetting: conrrectionApproveSetting,

      turnoverListSetting: turnoverListSetting, // 调离
      turnoverDetailSetting: turnoverDetailSetting,
      changeRosterForm: changeRosterForm,
      leaveListSetting: leaveListSetting, // 离职
      leaveDetailSetting: leaveDetailSetting,
      leaveApproveSetting: leaveApproveSetting,
      entryRules: {
        employeeName: [
          { required: true, message: '请输入员工名称', trigger: 'blur' },
          { min: 2, max: 20, message: '长度在 2 到 20个字符', trigger: 'blur' }
        ],
        targetOrgId: [
          { required: true, message: '请选择部门', trigger: 'blur' }
        ],
        targetPost: [
          { required: true, message: '请选择岗位', trigger: 'blur' }
        ],
        entryDate: [
          { required: true, message: '请选择入职日期', trigger: 'blur' }
        ],
        targetPostLevel: [
          { required: true, message: '请选择职级别', trigger: 'blur' }
        ],
        targetWorkAddr: [
          { required: true, message: '请输入工作地址', trigger: 'blur' }
        ],
        targetCompany: [
          { required: true, message: '请输入合同公司', trigger: 'blur' },
          { min: 0, max: 50, message: '长度在 0 到 20个字符', trigger: 'blur' }
        ]
      },
      delayRules: {
        delayCorrectionDate: [
          { required: true, message: '请输入工作地址', trigger: 'blur' }
        ],

        delayReason: [
          { required: true, message: '请输入延期原因', trigger: 'blur' },
          { min: 0, max: 200, message: '长度在 0 到 200个字符', trigger: 'blur' }
        ]
      },
      conrrectionRules: {
        targetOrgId: [
          { required: true, message: '请选择部门', trigger: 'blur' }
        ],
        targetPost: [
          { required: true, message: '请选择岗位', trigger: 'blur' }
        ],
        targetPostLevel: [
          { required: true, message: '请选择职级', trigger: 'blur' }
        ],
        conrrectionDate: [
          { required: true, message: '请选择转正日期', trigger: 'blur' }
        ],
        turnoverType: [
          { required: true, message: '必填项', trigger: 'blur' }
        ],
        turnoverCause: [
          { required: true, message: '必填项', trigger: 'blur' }
        ],
        targetWorkAddr: [
          { required: true, message: '必填项', trigger: 'blur' }
        ],
        targetCompany: [
          { required: true, message: '必填项', trigger: 'blur' }
        ],
        effectDate: [
          { required: true, message: '必填项', trigger: 'blur' }
        ]

      },
      leaveRules: {
        lastWorkDate: [
          { required: true, message: '请选择计划离职日期', trigger: 'blur' }
        ],
        salarySettledDate: [
          { required: true, message: '请选择薪资结算日期', trigger: 'blur' }
        ],
        leaveReason: [
          { required: true, message: '请输入离职原因', trigger: 'blur' },
          { min: 0, max: 100, message: '长度在 0 到 100个字符', trigger: 'blur' }
        ]

      },
      addRules: {
        reqName: [
          { required: true, message: '请输入需求名称', trigger: 'blur' },
          { min: 3, max: 50, message: '长度在 3 到 50个字符', trigger: 'blur' }
        ]
      },
      stopRules: {
        stopReason: [
          { required: true, message: '请输入停止招聘原因', trigger: 'blur' },
          { min: 3, max: 50, message: '长度在 3 到 50个字符', trigger: 'blur' }
        ]
      },
      searchParams: { // 搜索条件
        page: 1
      }
    }
  },
  mounted: function() {
    this.searchList('')
  },
  methods: {

    searchRosterSubmit(form) { // 高级搜索
      this.searchParams.page = 1
      this.searchParams.employeeName = form.employeeName
      this.searchParams.employeeNo = form.employeeNo
      this.searchParams.entryDate = form.entryDate
      this.searchParams.status = form.status
      this.searchParams.orgId = form.orgId
      this.searchParams.position = form.post
      this.searchParams.postLevel = form.postLevel
      this.searchList()
      this.$refs.searchRosterRef.hiden()
    },

    entryApprove(form) {
      updateBackDelay(form).then((response) => {
        if (response.success) {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.$refs.entryApproveRef.hiden()
          this.searchList()
        }
      })
    },
    delayApprove(form) { // 延期同意不同意
      dealDelayApprove(form).then((response) => {
        if (response.success) {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.$refs.delayApproveRef.hiden()
          this.searchList()
        }
      })
    },
    conrrectionApprove(form) { // 转正
      dealConrrectionApprove(form).then((response) => {
        if (response.success) {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.$refs.conrrectionApproveRef.hiden()
          this.searchList()
        }
      })
    },
    turnoverApprove(form) { // 调离
      dealTurnoverApprove(form).then((response) => {
        if (response.success) {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.$refs.turnoverApproveRef.hiden()
          this.searchList()
        }
      })
    },

    leaveApprove(form) { // 离职
      dealLeaveApprove(form).then((response) => {
        if (response.success) {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.$refs.leaveApproveRef.hiden()
          this.searchList()
        }
      })
    },
    // dealDelayApprove,dealConrrectionApprove,dealTurnoverApprove,dealLeaveApprove

    getTabs(status) {
      // this.tabs.countConrrection = 0
      // this.tabs.countTurnover = 0
      // this.tabs.countLeave = 0
      // this.tabs.countDelay = 0
      const params = {
        status: status
      }
      findStatusCount(params).then((request) => {
        this.statusData = request.data
        this.tabs.countEntry = request.data[0].countEntry
        this.tabs.countDelay = request.data[0].countDelay
        this.tabs.countConrrection = request.data[0].countConrrection
        this.tabs.countTurnover = request.data[0].countTurnover
        this.tabs.countLeave = request.data[0].countLeave
      })
    },


    findDetailById(Id, showCall, detail) { // 详情
      const status = this.getActivityStatus()
      const params = {
        id: Id
      }
      if (status === 0) {
        findDelayDetail(params).then((response) => {
          showCall(response.data)
        })
      }
      if (status === 1) {
        findConrrectDetail(params).then((response) => {
          showCall(response.data)
        })
      }
      if (status === 2) {
        findTurnoverDetail(params).then((response) => {
          // if (!detail) {
          //   response.data.targetOrgId = ''
          //   response.data.targetPost = ''
          //   response.data.targetPostLevel = ''
          // }

          showCall(response.data)
        })
      }
      if (status === 3) {
        findLeaveDetail(params).then((response) => {
          showCall(response.data)
        })
      }
      if (status === 4) {
        findEntryDetail(params).then((response) => {
          showCall(response.data)
        })
      }
    },

    listApprove(Id, dataStatus, action) { // 详情
      const status = this.getActivityStatus()
      const params = {
        id: Id
      }
      if (status === 0) {
        findDelayDetail(params).then((response) => {
          response.data.status = dataStatus
          response.data.action = action
          this.delayApprove(response.data)
        })
      }
      if (status === 1) {
        findConrrectDetail(params).then((response) => {
          response.data.status = dataStatus
          response.data.action = action
          this.conrrectionApprove(response.data)
        })
      }
      if (status === 2) {
        findTurnoverDetail(params).then((response) => {
          response.data.status = dataStatus
          response.data.action = action
          this.turnoverApprove(response.data)
        })
      }
      if (status === 3) {
        findLeaveDetail(params).then((response) => {
          response.data.status = dataStatus
          response.data.action = action
          this.leaveApprove(response.data)
        })
      }
      if (status === 4) {
        findEntryDetail(params).then((response) => {
          response.data.status = dataStatus
          response.data.action = action
          this.entryApprove(response.data)
        })
      }
    },


    searchList() {
      // if (!pageParams) {
      //   pageParams = {
      //     page: 1,
      //   }
      // }
      const pageParams = this.searchParams
      // if (!pageParams.status) {
      //   pageParams.status = '0'
      // }
      this.getTabs(pageParams.status)
      const status = this.getActivityStatus()
      if (status === 0) {
        getDealDelayList(pageParams).then((response) => {
          this.userData = response
        })
      }
      if (status === 1) {
        getConrrectionList(pageParams).then((response) => {
          this.userData = response
        })
      }
      if (status === 2) {
        getTurnoverList(pageParams).then((response) => {
          this.userData = response
        })
      }
      if (status === 3) {
        getLeaveList(pageParams).then((response) => {
          this.userData = response
        })
      }
      if (status === 4) {
        getEntryList(pageParams).then((response) => {
          this.userData = response
        })
      }
    },

    editSubmit(params, formType, formList) {
    },
    pageChange(pageObj) {
      this.searchParams.page = pageObj.page
      this.searchParams.pageSize = pageObj.pageSize
      this.searchList()
    },
    showSearch() {
      this.$refs.searchRosterRef.show()
    },
    addreq() {
      this.$refs.addRosterRef.show()
    },
    quickSearch() {
      this.searchParams.page = 1
      this.searchParams.employeeName = this.searchData
      this.searchList()
    },
    handleClick(tab, event) {
      this.searchParams.page = 1
      this.searchList()
    },
    addPlan() {

    },




    //     private int countConrrection;//转正(1)
    // private int countTurnover;//调动(2、3)
    // private int countLeave;//离职(5、7)
    // private int countDelay;//试用延期(4)

    getActivityStatus() {
      if (this.activeName === 'countDelay') {
        return 0;
      }
      if (this.activeName === 'countConrrection') {
        return 1;
      }
      if (this.activeName === 'countTurnover') {
        return 2;
      }
      if (this.activeName === 'countLeave') {
        return 3;
      }
      if (this.activeName === 'countEntry') {
        return 4;
      }
    }
  }
}
</script>

<style scoped>

</style>
